﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Adatkezelo.Classes;
namespace NEMProjectWebApp.Pages.Diak {
    public partial class oktelerhetoseg : System.Web.UI.Page {
        Login_Kezeles login = new Login_Kezeles();
        protected void Page_Load(object sender, EventArgs e) {
            string redirect = login.BelepesiJogkorEll(Session, 2);
            if (redirect.Length > 0) Response.Redirect(redirect);
        }

        protected void OktRadioButton_CheckedChanged(object sender, EventArgs e) {
            if (OktRadioButton.Checked) {
                Targylabel.Text = "Okatók:";
                SqlDataSource1.SelectCommand = "SELECT [User_ID] as T_ID, ([VezNev] + ' ' + [KerNev]) as TargyNeve FROM [Felhasznalo] WHERE [FelhasznJogkorei_ID] = 3";
                SqlDataSource1.DataBind();
                TargyDropDownList.DataBind();
            }
        }

        protected void AnyagRadioButton_CheckedChanged(object sender, EventArgs e) {
            if (AnyagRadioButton.Checked) {
                Targylabel.Text = "Tárgyak:";
                SqlDataSource1.SelectCommand = "SELECT [T_ID], [TargyNeve] FROM [Targy]";
                SqlDataSource1.DataBind();
                TargyDropDownList.DataBind();
            }
        }
        Tanar_anyag_ertekelese TAE = new Tanar_anyag_ertekelese();
        protected void ElkuldButton_Click(object sender, EventArgs e) {
            if (AnyagRadioButton.Checked) {
                TAE.TargyErtek(TargyDropDownList.SelectedValue, ErtekelTextBox.Text);
            } else {
                TAE.OktatoErtek(TargyDropDownList.SelectedValue, ErtekelTextBox.Text);
            }
        }
    }
}